﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;

public partial class sysadmin_CountManager_FCPaper : PowerCreator.LMS.Web.Base.BasePage
{
    //ManagerUserPaperHistoryInfo objUserPaperHistorylogic = new ManagerUserPaperHistoryInfo();
    //ManagerPaperInfo paperManager = new ManagerPaperInfo();

    #region XML数据模版 ？为什么不采用模版的方式，新建了FusionCharts类，但是不能用

    //图表抬头 Title, xAxisName=X轴的名称，yAxisName=y轴显示的名称,yAxisMaxValue=y轴最大值
    const string GRAPH = "<graph  caption='试卷通过率'  xAxisName='通过率值' yAxisName='试卷描述信息' decimalPrecision='0' formatNumberScale='0' yAxisMaxValue='100' baseFontSize='14'> ";
    //名称，值，颜色
    const string GRAPH_TR = "<set name='{0}' value='{1}' color='{2}' />";
    const string GRAPH_END = "</graph>";
    //    const string REPORT_URL = "/FusionCharts/FCF_Column3D.swf";


    //3D饼图
    const string VIEW_START = "<graph showNames='1'  decimalPrecision='0' baseFontSize='14'>";
    const string VIEW_DATA_TD = "<set name='{0}' value='{1}' />";
    const string VIEW_END = "</graph>";
    const string VIEW_URL = "/FusionCharts/FCF_Pie3D.swf";

    #endregion 

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //ViewState["PaperID"] = Base64.Decode(Request.QueryString["p"].ToString());
            //string xml = GetXmlPie3D();
            //if (!string.IsNullOrEmpty(xml))
            //{
            //    string url = Utils.WebRoot + VIEW_URL;
            //    literal1.Text = InfoSoftGlobal.FusionCharts.RenderChartHTML(url, "", xml, "myxml", "800", "400", false);
            //}
            //else
            //{
            //    literal1.Text = "目前没有该试卷的统计信息";
            //}
        }
    }

    private DataTable GetData()
    {
        DataTable dt = new DataTable();
        //string search = " and PaperID=" + ViewState["PaperID"].ToString();
        
        //dt = objUserPaperHistorylogic.GetPaperList_View(search, 1, 1);
        ////if (dt.Rows[0]["passcount"].ToString() != "")
        ////{
        ////    PassCount = int.Parse(dt.Rows[0]["passcount"].ToString());
        ////}
        ////int UserSumCount = int.Parse(dt.Rows[0]["Usercount"].ToString());
        ////int UnPassCount = UserSumCount - PassCount;

        ////lab_pass.Text = "通过人数：" + PassCount.ToString();
        ////lab_UnPass.Text = "未通过人数：" + UnPassCount.ToString();
        ////lab_UserCount.Text = UserSumCount.ToString();

        return dt;
    }
    private string GetXmlPie3D()
    {
        StringBuilder sbXML = new StringBuilder();
        //DataTable dt = new DataTable();
        //dt = GetData();
        //int passv = 0;
        //int maxv = 0;

        //sbXML.Append(VIEW_START);
        //for (int i = 0; i < dt.Rows.Count; i++)
        //{
        //    maxv = int.Parse(dt.Rows[i]["Usercount"].ToString());

        //    if (!string.IsNullOrEmpty(dt.Rows[i]["PassCount"].ToString()))
        //    {
        //        passv = int.Parse(dt.Rows[i]["PassCount"].ToString());
        //    }
        //    sbXML.Append(string.Format(VIEW_DATA_TD, "参加总人数", maxv));
        //    sbXML.Append(string.Format(VIEW_DATA_TD, "己通过人数", passv));

        //}
        //sbXML.Append(VIEW_END);
        //if (dt.Rows.Count == 0)
        //{
        //    sbXML.Remove(0, sbXML.Length);
        //}
        return sbXML.ToString();

    }

    private string GetXml()
    {
        StringBuilder sbXML = new StringBuilder();
        //DataTable dt = new DataTable();
        //dt = GetData();
        //int passv = 0;
        //int maxv = 0;
        
        //sbXML.Append(GRAPH);
        //for (int i = 0; i < dt.Rows.Count; i++)
        //{            
        //    maxv = int.Parse(dt.Rows[i]["Usercount"].ToString());

        //    if (!string.IsNullOrEmpty(dt.Rows[i]["PassCount"].ToString()))
        //    {
        //        passv = int.Parse(dt.Rows[i]["PassCount"].ToString());
        //    }
        //    sbXML.Append(string.Format(GRAPH_TR, "参加总人数", maxv, ReportUtils.GetColorRander(6)));
        //    sbXML.Append(string.Format(GRAPH_TR, "己通过人数", passv, ReportUtils.GetColorRander(6)));            

        //}
        //sbXML.Append(GRAPH_END);
        //if (dt.Rows.Count == 0)
        //{
        //    sbXML.Remove(0, sbXML.Length);
        //}
        return sbXML.ToString();
    }
}
